import service from "@/utils/request"

import LoginWork from "@/utils/LoginWork"

// 保存
export const RdTypeBodyFileSave = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/saveList`,parms) 
}

// 厂商查询
export const ObtainVendor = (parms:any) => {
    return service.get<any,any>(`/mes/kfBom/vendorList`,parms)
}


// 根据型体查询订单号信息
export const RdTypeBodyFileOrderList = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/styleColorByOrderIdList?styleNo=${parms.styleNo}&styleColor=${parms.styleColor}`)
}

// 新增
export const RdTypeBodyFileAdd = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/head/save`,parms) 
}

// 整单型体删除
export const RdTypeBodyFileDelete = (parms:any) => {
    return service.delete<any,any>(`/mes/kfBom/deleteBom/?id=${parms}`)  
}

// 检核
export const RdTypeBodyFileCheck = (parms:any) => {
    return service.put<any,any>(`/mes/kfBom/check?id=${parms}`) 
}


// 取消检核
export const RdTypeBodyFileCancelCheck = (parms:any) => {
    return service.put<any,any>(`/mes/kfBom/cancelCheck?id=${parms}`) 
}


// BOM修改
export const RdTypeBodyFileEdit = (parms:any) => {
    return service.put<any,any>(`/mes/kfBom/head/update`,parms) 
}


// 注意事项建档删除
export const RdTypeBodyFileNoteDelete = (parms:any) => {
    return service.delete<any,any>(`/mes/kfBom/deleteMemo?id=${parms}`)
}

// 部位列表查询
export const RdTypeBodyFilePositionList = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/list?pageNum=${parms.pageNum}&pageSize=${parms.pageSize}`,parms) 
}

export const UsageChangeQuery = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/changeList`,parms)
}



// 型体查询
export interface TypeQueryParms{
    colorCode:string,
    pageNum:number,
    pageSize:number,
    styleColor:string,
    styleNo:string
}

export const TypeQuery = (parms:TypeQueryParms) => {
    return service.post<any,any>("/mes/kfBom/bomHeadList",parms)
}

// 颜色代码
export interface ColorCodePictureParms{
    colorCode:string,
    pageNum:number,
    pageSize:number,
    styleColor:string,
    styleNo:string
}
 
export interface ColorCodePictureTableDate{
    list:list[]
    total?:number
}

interface list{
    styleColor: string,
    colorCode: string,
    photoPath: string
    remark: string
}

export const ColorCodePicture = (parms:ColorCodePictureParms) => {
    return service.post<any,any>(`/developmentUsage/getStyleToColorQuery`,parms)
}

// 型体颜色资料查询
export interface TypeColorDataQueryParms{
    styleNo:string
    styleColor:string
}

export interface TypeColorDataQueryInterface{
    seqNo: string | number,
    partName: any,
    segment: string,
    mtlNo: string,
    mtlName: string,
    mtlColor: string,
    mtlSpec: string,
    mtlUnit: string,
    size1: null,
    size2: null,
    vendor: string,
    usage: null,
    usageType: string,
    drawDept: string,
    sizeType: string,
    mtlProperty: string,
    noLotUsage: null,
    remark: null
}

export const TypeColorDataQuery = (parms:TypeColorDataQueryParms) => {
    return service.post<any,any>('/mes/kfBom/bomList',parms)
}

// 部位明细查询
export interface PositionDetailQueryPamrs{
    engPartName:string,
    pageNum:number,
    pageSize:number,
    partName:string,
    seqNo:string
}

export const PositionDetailQuery = (parms:PositionDetailQueryPamrs) => {
    return service.post<any,any>(`/date/getPartList`,parms)
}

// 贴合子材料明细查询
export interface LaminatedSubmaterialInterface{
    id: null,
    mtlNo: string,
    mtlColor: null,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    percent: 1,
    purFlag: string,
    mtlSeq: 2,
    prdType: null,
    vendor: null,
    colorCode: null
}

export const LaminatedSubmaterial = (parms:any) => {
    return service.post<any,LaminatedSubmaterialInterface[]>('/usage/getDetailsOfAdhesiveSubMaterials',parms)
}

// 全码用量资料查询
export interface FullCodeUsageDataParms{
    partName:string,
    segment:number | string,
    styleColor:string,
    styleNo:string
}

export const FullCodeUsageData = (parms:FullCodeUsageDataParms) => {
    return service.post<any,any>(`/developmentUsage/getFullCodeDetailList`,parms)
}

// 检核
export const FullCodeUsageCheck = (choose:number,parms:any) => {
    return LoginWork.post<any,any>(`/developmentUsage/getCheckOut/${choose}`,parms)
}

// 保存
export interface saveDateListParms{
    styleColor:string,
    styleColorMaterialRequests:any[],
    styleColorRemark:string,
    styleNo:string
}

export const saveDateList = (parms:saveDateListParms) => {
    return LoginWork.post<any,any>(`/developmentUsage/getStyleUsageDetailAdd`,parms)
}

// 用量明细查询
export interface UsageDetailQueryParms{
    styleNo:string,
    styleColor: string,
    typeName: string,
    seqNo: string,
    partName: string,
    segment: string,
    mtlNo: string,
    mtlName: string,
    mtlColor: string,
    mtlSpec: null,
    mtlUnit: string,
    size1: null,
    size2: null,
    vendor: null,
    usage:string,
    usageType: string,
    drawDept: string,
    sizeType: string,
    mtlProperty: string,
    noLotUsage: null,
    remark: null
}

export interface UsageDetailQueryParmsList{
    total?:number,
    list:UsageDetailQueryParms[]
}

export interface UsageDetailQueryPamrsList{
    mtlColor:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    partName:string,
    styleColor:string,
    styleNo:string,
    typeName:string
}

export const UsageDetailQuery = (parms:UsageDetailQueryPamrsList) => {
    return service.post<any,UsageDetailQueryParmsList>(`/developmentUsage/getUsageDetailsQuery`,parms)
}

// 用量变更查询
export interface UsageChangeQueryparms{
    colorCode:string,
    pageNum:number,
    pageSize:number,
    styleColor:string,
    styleNo:string
}

export interface UsageChangeQueryInterface{
    total?:number
    list:UsageChangeQueryList[]
}

interface UsageChangeQueryList {
    partName: string,
    segment: number,
    changeType: string,
    remark:string,
    sysUser: string,
    sysDate: string
}



// 注意事项建档列表
export const PrecautionsFile = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/memoList`,parms)
}

// 注意事项建档
export const PrecautionsFileList = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/addMemo`,parms)
}

// 复制资料
export interface CopyDataParms{
    colorCode:string,
    newColorCode:string,
    newStyleColor:string,
    newStyleNo:string,
    styleColor:string,
    styleNo:string,
    wantColor:string
}

export const CopyData = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/copyBom?id=${parms.id}&newOrderId=${parms.newOrderId}&newColor=${parms.newColor}&newStyle=${parms.newStyle}`)
}

// 删除打勾记录型体
export interface DeleteTheCheckmarkedRecordTypePamrs{
    seqNoList:[],
    styleColor:string,
    styleNo:string
}

export const DeleteTheCheckmarkedRecordType = (parms:any) => {
    return service.delete<any,any>(`/mes/kfBom/deleteInfo?ids=${parms}`)
}

// 更新全码用量
export interface UpdateFullCodeUsagePamrs{
    list:any[],
    styleColor:string,
    styleNo:string
}

export const UpdateFullCodeUsage = (parms:UpdateFullCodeUsagePamrs) => {
    return service.post<any,any>(`/usage/getFullCodeDetailRenew`,parms)
}

// 选择材料当前行正式材料插入
export interface SelectTheCurrentRowToInsertParms{
    colorCode:string,
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    partName:string,
    segment:null | string,
    seqNo:string,
    styleColor:string,
    styleNo:string,
    vendor:string
}

export const SelectTheCurrentRowToInsert = (parms:SelectTheCurrentRowToInsertParms) => {
    return service.post<any,any>(`/mes/kfBom/bomPartNew3`,parms)
}

// 生产正式材料并选择到用量表
export interface ProductionOfOfficialMaterialsParms{
    colorCode:string,
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    partName:string,
    segment:number | null,
    seqNo:string,
    styleColor:string,
    styleNo:string,
    vendor:string
}

export const ProductionOfOfficialMaterials = (parms:ProductionOfOfficialMaterialsParms) => {
    return service.post<any,any>(`/mes/kfBom/bomPartNew4`,parms)
}

// 贴合材料处理->插入
export interface InsertTheBondingMaterialParms{
    colorCode:string,
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    partName:string,
    segment:number,
    seqNo:string,
    styleColor:string,
    styleNo:string,
    vendor:string
}

export const InsertTheBondingMaterial = (parms:InsertTheBondingMaterialParms) => {
    return service.post<any,any>(`/mes/kfBom/bomPartNew2`,parms)
}

// export const InsertTheBondingMaterial1 = (parms:InsertTheBondingMaterialParms) => {
//     return service.post<any,any>(`/date/getInsertMaterial2`,parms)
// }

// 型体配色
export const styleColorQuery = (parms:any) =>{
    return service.post<any,any>(`/developmentUsage/getStyleQueryByOrderId`,parms)
}

// 贴合材料处理-还原
export const BondingMaterialTreatment = (parm:any) => {
    return service.post<any,any>(`/date/restoration`,parm)
}

// 选择材料
export const selectMtlName = (parms:any) => {
    return service.post<any,any>(`/date/getMtlNameByMaterial`,parms)
}

// 复制材料
export const copyData = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/mtlNoByBom`,parms)
}

// 部位查询
export const partNameQuery = (partName:string) => {
    return service.get<any,any>(`/mes/kfBom/checkPartName?partName=${partName}`)
}

// 删除正式材料
export const deleteCofficial = (partName:string) => {
    return service.delete<any,any>(`/mes/kfBom/delMaterial?id=${partName}`)
}

// 保存基本号码
export const BasicNumber = (parms:any) =>{
    return service.post<any,any>(`/developmentUsage/updateBaseSize`,parms)
}

// 根据ID查询
export const idQuery = (parms:any) => {
    return service.post<any,any>(`/mes/kfBom/bomInfo/${parms}`)
}